package Form;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Toolkit;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import Control.Workshop_ViewWorkshop_Controller;

@SuppressWarnings("serial")
public class Workshop_ViewWorkshop_Form extends JPanel{
	//Class Attributes
	private JLabel lblTitle;
	private JLabel lblWorkshopid;
	private JLabel lblCategory;
	private JLabel category;
	private JLabel lblDescription;
	private JScrollPane scrollPane;
	private JTextArea description;
	private JLabel lblVenue;
	private JLabel venue;
	private JLabel lblDatetime;
	private JLabel lblStartdatetime;
	private JLabel lblEnddatetime;
	private JLabel lblTo;
	private JLabel lblCapacity;
	private JLabel capacity;
	private JLabel lblTrainer;
	private JLabel trainer;
	private JLabel lblStatus;
	private JLabel status;
	private JLabel lblWorkshopDate;
	private JLabel workshopdate;
	private JButton btn;
	private JLabel lblBG;
	private JLabel lblGrayBG;
	
	//Object Attributes
	private Workshop_WorkshopMain_Form parser;
	private Workshop_ViewBooking_Form viewParser;
	private Workshop_ViewWorkshop_Controller control;

	public Workshop_WorkshopMain_Form getParser() {
		return parser;
	}
	
	public void setParser(Workshop_WorkshopMain_Form parser) {
		this.parser = parser;
	}
	
	public Workshop_ViewBooking_Form getViewParser() {
		return viewParser;
	}

	public void setViewParser(Workshop_ViewBooking_Form viewParser) {
		this.viewParser = viewParser;
	}

	public Workshop_ViewWorkshop_Controller getControl() {
		return control;
	}
	
	public void setControl(Workshop_ViewWorkshop_Controller control) {
		this.control = control;
	}
	
	/**
	 * @wbp.parser.constructor
	 */
	public Workshop_ViewWorkshop_Form(Workshop_WorkshopMain_Form parser) {
		this.setParser(parser);
		initialiseGUI();
	}
	
	public Workshop_ViewWorkshop_Form(Workshop_ViewBooking_Form viewParser){
		this.setViewParser(viewParser);
		initialiseGUI();
	}
	
	public void initialiseGUI(){		
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[] {15, 90, 70, 120, 30, 120, 100, 15};
		gridBagLayout.rowHeights = new int[] {30, 30, 30, 75, 25, 25, 25, 25, 25, 30, 0};
		gridBagLayout.columnWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0};
		gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0};
		setLayout(gridBagLayout);
		GridBagConstraints gbc_lblTitle = new GridBagConstraints();
		gbc_lblTitle.gridwidth = 6;
		gbc_lblTitle.anchor = GridBagConstraints.SOUTHWEST;
		gbc_lblTitle.insets = new Insets(0, 0, 5, 5);
		gbc_lblTitle.gridx = 1;
		gbc_lblTitle.gridy = 0;
		add(getLblTitle(), gbc_lblTitle);
		GridBagConstraints gbc_lblWorkshopid = new GridBagConstraints();
		gbc_lblWorkshopid.anchor = GridBagConstraints.EAST;
		gbc_lblWorkshopid.insets = new Insets(0, 0, 5, 5);
		gbc_lblWorkshopid.gridx = 6;
		gbc_lblWorkshopid.gridy = 0;
		add(getLblWorkshopid(), gbc_lblWorkshopid);
		GridBagConstraints gbc_workshopdate = new GridBagConstraints();
		gbc_workshopdate.anchor = GridBagConstraints.NORTHWEST;
		gbc_workshopdate.gridwidth = 2;
		gbc_workshopdate.insets = new Insets(1, 0, 5, 5);
		gbc_workshopdate.gridx = 2;
		gbc_workshopdate.gridy = 1;
		add(getWorkshopdate(), gbc_workshopdate);
		GridBagConstraints gbc_lblWorkshopDate = new GridBagConstraints();
		gbc_lblWorkshopDate.anchor = GridBagConstraints.NORTHEAST;
		gbc_lblWorkshopDate.insets = new Insets(0, 0, 5, 5);
		gbc_lblWorkshopDate.gridx = 1;
		gbc_lblWorkshopDate.gridy = 1;
		add(getLblWorkshopDate(), gbc_lblWorkshopDate);
		GridBagConstraints gbc_lblCategory = new GridBagConstraints();
		gbc_lblCategory.gridwidth = 2;
		gbc_lblCategory.anchor = GridBagConstraints.EAST;
		gbc_lblCategory.insets = new Insets(0, 0, 5, 5);
		gbc_lblCategory.gridx = 1;
		gbc_lblCategory.gridy = 2;
		add(getLblCategory(), gbc_lblCategory);
		GridBagConstraints gbc_category = new GridBagConstraints();
		gbc_category.fill = GridBagConstraints.HORIZONTAL;
		gbc_category.insets = new Insets(0, 0, 5, 5);
		gbc_category.gridx = 3;
		gbc_category.gridy = 2;
		add(getCategory(), gbc_category);
		GridBagConstraints gbc_lblDescription = new GridBagConstraints();
		gbc_lblDescription.gridwidth = 2;
		gbc_lblDescription.anchor = GridBagConstraints.NORTHEAST;
		gbc_lblDescription.insets = new Insets(0, 0, 5, 5);
		gbc_lblDescription.gridx = 1;
		gbc_lblDescription.gridy = 3;
		add(getLblDescription(), gbc_lblDescription);
		GridBagConstraints gbc_scrollPane = new GridBagConstraints();
		gbc_scrollPane.gridwidth = 4;
		gbc_scrollPane.insets = new Insets(0, 0, 5, 5);
		gbc_scrollPane.fill = GridBagConstraints.BOTH;
		gbc_scrollPane.gridx = 3;
		gbc_scrollPane.gridy = 3;
		add(getScrollPane(), gbc_scrollPane);
		GridBagConstraints gbc_lblVenue = new GridBagConstraints();
		gbc_lblVenue.gridwidth = 2;
		gbc_lblVenue.anchor = GridBagConstraints.EAST;
		gbc_lblVenue.insets = new Insets(0, 0, 5, 5);
		gbc_lblVenue.gridx = 1;
		gbc_lblVenue.gridy = 4;
		add(getLblVenue(), gbc_lblVenue);
		GridBagConstraints gbc_venue = new GridBagConstraints();
		gbc_venue.gridwidth = 2;
		gbc_venue.fill = GridBagConstraints.HORIZONTAL;
		gbc_venue.insets = new Insets(0, 0, 5, 5);
		gbc_venue.gridx = 3;
		gbc_venue.gridy = 4;
		add(getVenue(), gbc_venue);
		GridBagConstraints gbc_lblDatetime = new GridBagConstraints();
		gbc_lblDatetime.gridwidth = 2;
		gbc_lblDatetime.anchor = GridBagConstraints.EAST;
		gbc_lblDatetime.insets = new Insets(0, 0, 5, 5);
		gbc_lblDatetime.gridx = 1;
		gbc_lblDatetime.gridy = 5;
		add(getLblDatetime(), gbc_lblDatetime);
		GridBagConstraints gbc_lblStartdatetime = new GridBagConstraints();
		gbc_lblStartdatetime.fill = GridBagConstraints.HORIZONTAL;
		gbc_lblStartdatetime.insets = new Insets(0, 0, 5, 5);
		gbc_lblStartdatetime.gridx = 3;
		gbc_lblStartdatetime.gridy = 5;
		add(getStartdatetime(), gbc_lblStartdatetime);
		GridBagConstraints gbc_lblTo = new GridBagConstraints();
		gbc_lblTo.insets = new Insets(0, 0, 5, 5);
		gbc_lblTo.gridx = 4;
		gbc_lblTo.gridy = 5;
		add(getLblTo(), gbc_lblTo);
		GridBagConstraints gbc_lblEnddatetime = new GridBagConstraints();
		gbc_lblEnddatetime.fill = GridBagConstraints.HORIZONTAL;
		gbc_lblEnddatetime.insets = new Insets(0, 0, 5, 5);
		gbc_lblEnddatetime.gridx = 5;
		gbc_lblEnddatetime.gridy = 5;
		add(getEnddatetime(), gbc_lblEnddatetime);
		GridBagConstraints gbc_lblCapacity = new GridBagConstraints();
		gbc_lblCapacity.gridwidth = 2;
		gbc_lblCapacity.anchor = GridBagConstraints.EAST;
		gbc_lblCapacity.insets = new Insets(0, 0, 5, 5);
		gbc_lblCapacity.gridx = 1;
		gbc_lblCapacity.gridy = 6;
		add(getLblCapacity(), gbc_lblCapacity);
		GridBagConstraints gbc_capacity = new GridBagConstraints();
		gbc_capacity.fill = GridBagConstraints.HORIZONTAL;
		gbc_capacity.insets = new Insets(0, 0, 5, 5);
		gbc_capacity.gridx = 3;
		gbc_capacity.gridy = 6;
		add(getCapacity(), gbc_capacity);
		GridBagConstraints gbc_lblTrainer = new GridBagConstraints();
		gbc_lblTrainer.gridwidth = 2;
		gbc_lblTrainer.anchor = GridBagConstraints.EAST;
		gbc_lblTrainer.insets = new Insets(0, 0, 5, 5);
		gbc_lblTrainer.gridx = 1;
		gbc_lblTrainer.gridy = 7;
		add(getLblTrainer(), gbc_lblTrainer);
		GridBagConstraints gbc_trainer = new GridBagConstraints();
		gbc_trainer.fill = GridBagConstraints.HORIZONTAL;
		gbc_trainer.insets = new Insets(0, 0, 5, 5);
		gbc_trainer.gridx = 3;
		gbc_trainer.gridy = 7;
		add(getTrainer(), gbc_trainer);
		GridBagConstraints gbc_lblStatus = new GridBagConstraints();
		gbc_lblStatus.gridwidth = 2;
		gbc_lblStatus.anchor = GridBagConstraints.EAST;
		gbc_lblStatus.insets = new Insets(0, 0, 5, 5);
		gbc_lblStatus.gridx = 1;
		gbc_lblStatus.gridy = 8;
		add(getLblStatus(), gbc_lblStatus);
		GridBagConstraints gbc_status = new GridBagConstraints();
		gbc_status.fill = GridBagConstraints.HORIZONTAL;
		gbc_status.insets = new Insets(0, 0, 5, 5);
		gbc_status.gridx = 3;
		gbc_status.gridy = 8;
		add(getStatus(), gbc_status);
		GridBagConstraints gbc_btn = new GridBagConstraints();
		gbc_btn.anchor = GridBagConstraints.EAST;
		gbc_btn.gridwidth = 2;
		gbc_btn.insets = new Insets(0, 0, 5, 5);
		gbc_btn.gridx = 5;
		gbc_btn.gridy = 9;
		add(getBtn(), gbc_btn);
		GridBagConstraints gbc_lblGrayBG = new GridBagConstraints();
		gbc_lblGrayBG.gridwidth = 8;
		gbc_lblGrayBG.gridheight = 11;
		gbc_lblGrayBG.gridx = 0;
		gbc_lblGrayBG.gridy = 0;
		add(getLblGrayBG(), gbc_lblGrayBG);
		GridBagConstraints gbc_lblBG = new GridBagConstraints();
		gbc_lblBG.gridwidth = 8;
		gbc_lblBG.gridheight = 11;
		gbc_lblBG.gridx = 0;
		gbc_lblBG.gridy = 0;
		add(getLblBG(), gbc_lblBG);

		this.setControl(new Workshop_ViewWorkshop_Controller(this));
	}

	public JLabel getLblTitle() {
		if (lblTitle == null) {
			lblTitle = new JLabel("View Workshop");
			lblTitle.setForeground(Color.LIGHT_GRAY);
			lblTitle.setFont(new Font("Rockwell", Font.BOLD, 28));
		}
		return lblTitle;
	}
	public JLabel getLblWorkshopid() {
		if (lblWorkshopid == null) {
			lblWorkshopid = new JLabel("");
			lblWorkshopid.setForeground(Color.WHITE);
			lblWorkshopid.setBackground(new Color(0, 0, 0, 180));
			lblWorkshopid.setOpaque(true);
		}
		return lblWorkshopid;
	}
	public JLabel getLblCategory() {
		if (lblCategory == null) {
			lblCategory = new JLabel("Category:");
			lblCategory.setFont(new Font("Tahoma", Font.BOLD, 13));
			lblCategory.setForeground(Color.WHITE);
			lblCategory.setBackground(new Color(0, 0, 0, 180));
			lblCategory.setOpaque(true);
		}
		return lblCategory;
	}
	public JLabel getCategory() {
		if (category == null) {
			category = new JLabel("");
			category.setFont(new Font("Tahoma", Font.BOLD, 12));
			category.setForeground(Color.WHITE);
		}
		return category;
	}
	public JLabel getLblDescription() {
		if (lblDescription == null) {
			lblDescription = new JLabel("Description:");
			lblDescription.setFont(new Font("Tahoma", Font.BOLD, 13));
			lblDescription.setForeground(Color.WHITE);
			lblDescription.setBackground(new Color(0, 0, 0, 180));
			lblDescription.setOpaque(true);
		}
		return lblDescription;
	}
	public JScrollPane getScrollPane() {
		if (scrollPane == null) {
			scrollPane = new JScrollPane();
			scrollPane.setViewportView(getDescription());
		}
		return scrollPane;
	}
	public JTextArea getDescription() {
		if (description == null) {
			description = new JTextArea();
			description.setFont(new Font("Tahoma", Font.PLAIN, 13));
			description.setEditable(false);
			description.setLineWrap(true);
		}
		return description;
	}
	public JLabel getLblVenue() {
		if (lblVenue == null) {
			lblVenue = new JLabel("Venue:");
			lblVenue.setFont(new Font("Tahoma", Font.BOLD, 13));
			lblVenue.setForeground(Color.WHITE);
			lblVenue.setBackground(new Color(0, 0, 0, 180));
			lblVenue.setOpaque(true);
		}
		return lblVenue;
	}
	public JLabel getVenue() {
		if (venue == null) {
			venue = new JLabel("");
			venue.setFont(new Font("Tahoma", Font.BOLD, 12));
			venue.setForeground(Color.WHITE);
		}
		return venue;
	}
	public JLabel getLblDatetime() {
		if (lblDatetime == null) {
			lblDatetime = new JLabel("Date/Time:");
			lblDatetime.setFont(new Font("Tahoma", Font.BOLD, 13));
			lblDatetime.setForeground(Color.WHITE);
			lblDatetime.setBackground(new Color(0, 0, 0, 180));
			lblDatetime.setOpaque(true);
		}
		return lblDatetime;
	}
	public JLabel getStartdatetime() {
		if (lblStartdatetime == null) {
			lblStartdatetime = new JLabel("");
			lblStartdatetime.setForeground(Color.WHITE);
			lblStartdatetime.setFont(new Font("Tahoma", Font.BOLD, 12));
		}
		return lblStartdatetime;
	}
	public JLabel getEnddatetime() {
		if (lblEnddatetime == null) {
			lblEnddatetime = new JLabel("");
			lblEnddatetime.setForeground(Color.WHITE);
			lblEnddatetime.setFont(new Font("Tahoma", Font.BOLD, 12));
		}
		return lblEnddatetime;
	}
	public JLabel getLblTo() {
		if (lblTo == null) {
			lblTo = new JLabel("to");
			lblTo.setForeground(Color.WHITE);
			lblTo.setBackground(new Color(0, 0, 0, 180));
			lblTo.setOpaque(true);
		}
		return lblTo;
	}
	public JLabel getLblCapacity() {
		if (lblCapacity == null) {
			lblCapacity = new JLabel("Capacity:");
			lblCapacity.setFont(new Font("Tahoma", Font.BOLD, 13));
			lblCapacity.setForeground(Color.WHITE);
			lblCapacity.setBackground(new Color(0, 0, 0, 180));
			lblCapacity.setOpaque(true);
		}
		return lblCapacity;
	}
	public JLabel getCapacity() {
		if (capacity == null) {
			capacity = new JLabel("");
			capacity.setFont(new Font("Tahoma", Font.BOLD, 12));
			capacity.setForeground(Color.WHITE);
		}
		return capacity;
	}
	public JLabel getLblTrainer() {
		if (lblTrainer == null) {
			lblTrainer = new JLabel("Trainer:");
			lblTrainer.setFont(new Font("Tahoma", Font.BOLD, 13));
			lblTrainer.setForeground(Color.WHITE);
			lblTrainer.setBackground(new Color(0, 0, 0, 180));
			lblTrainer.setOpaque(true);
		}
		return lblTrainer;
	}
	public JLabel getTrainer() {
		if (trainer == null) {
			trainer = new JLabel("");
			trainer.setForeground(Color.WHITE);
			trainer.setFont(new Font("Tahoma", Font.BOLD, 12));
		}
		return trainer;
	}
	public JLabel getLblStatus() {
		if (lblStatus == null) {
			lblStatus = new JLabel("Status:");
			lblStatus.setFont(new Font("Tahoma", Font.BOLD, 13));
			lblStatus.setForeground(Color.WHITE);
			lblStatus.setBackground(new Color(0, 0, 0, 180));
			lblStatus.setOpaque(true);
		}
		return lblStatus;
	}
	public JLabel getStatus() {
		if (status == null) {
			status = new JLabel("");
			status.setForeground(Color.WHITE);
			status.setFont(new Font("Tahoma", Font.BOLD, 12));
		}
		return status;
	}
	public JLabel getLblWorkshopDate() {
		if (lblWorkshopDate == null) {
			lblWorkshopDate = new JLabel("Created on:");
			lblWorkshopDate.setFont(new Font("Tahoma", Font.BOLD, 13));
			lblWorkshopDate.setForeground(Color.WHITE);
			lblWorkshopDate.setBackground(new Color(0, 0, 0, 180));
			lblWorkshopDate.setOpaque(true);
		}
		return lblWorkshopDate;
	}
	public JLabel getWorkshopdate() {
		if (workshopdate == null) {
			workshopdate = new JLabel("");
			workshopdate.setFont(new Font("Tahoma", Font.BOLD, 12));
			workshopdate.setForeground(Color.WHITE);
		}
		return workshopdate;
	}
	public JButton getBtn() {
		if (btn == null) {
			btn = new JButton("");
		}
		return btn;
	}
	public JLabel getLblBG() {
		if (lblBG == null) {
			lblBG = new JLabel("");
			lblBG.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Workshop/workshopview.jpg").getScaledInstance(570, 340, Image.SCALE_DEFAULT)));
		}
		return lblBG;
	}
	public JLabel getLblGrayBG() {
		if (lblGrayBG == null) {
			lblGrayBG = new JLabel("");
			lblGrayBG.setPreferredSize(new Dimension(550, 330));
			lblGrayBG.setBackground(new Color(0, 0, 0, 180));
			lblGrayBG.setOpaque(true);
		}
		return lblGrayBG;
	}
}
